import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { OrderInfoVO, OrderInfoForm, OrderInfoQuery } from '@/api/shopping/order/info/types';

/**
 * 查询订单详情内容  订单里面的 商品列列表
 * @param query
 * @returns {*}
 */

export const listOrderInfo = (query?: OrderInfoQuery): AxiosPromise<OrderInfoVO[]> => {
  return request({
    url: '/shopping/orderInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询订单详情内容  订单里面的 商品列详细
 * @param id
 */
export const getOrderInfo = (id: string | number): AxiosPromise<OrderInfoVO> => {
  return request({
    url: '/shopping/orderInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增订单详情内容  订单里面的 商品列
 * @param data
 */
export const addOrderInfo = (data: OrderInfoForm) => {
  return request({
    url: '/shopping/orderInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改订单详情内容  订单里面的 商品列
 * @param data
 */
export const updateOrderInfo = (data: OrderInfoForm) => {
  return request({
    url: '/shopping/orderInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除订单详情内容  订单里面的 商品列
 * @param id
 */
export const delOrderInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/shopping/orderInfo/' + id,
    method: 'delete'
  });
};
